//
//  ViewController.swift
//  闭包
//
//  Created by Summer on 2017/11/3.
//  Copyright © 2017年 Summer. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        let rect = CGRect(x: 0, y: 20, width: view.bounds.width, height: 44)
        let sv = LPXScrollView(frame: rect, nummber: { () -> Int in
            return 20
        }) { (index) -> UILabel in
            let label = UILabel()
            label.text = "Hello\(index)"
            label.textColor = #colorLiteral(red: 1, green: 0, blue: 1, alpha: 1)
            label.font = UIFont.systemFont(ofSize: 18)
            label.sizeToFit()
            label.font = UIFont.systemFont(ofSize: 14)
            return label
        }
        // swift中不用写 self. 在需要的时候写
        view.addSubview(sv)
    }
    

}

